package com.yangguang.huahui.mvp.presenter;

import com.yangguang.huahui.entity.AttentionList;
import com.yangguang.huahui.mvp.model.SupplyModel;
import com.yangguang.huahui.mvp.view.MiaomuView;
import com.yangguang.huahui.rx.RxManager;
import com.yangguang.huahui.rx.RxSubscriber;

/**
 * Created by Administrator on 2017/3/3.
 */

public class MiaomuPresenter extends BasePresenter<MiaomuView>{
    SupplyModel miaomuModel;

    public MiaomuPresenter() {
        miaomuModel = new SupplyModel();
    }
    public void getSeedlings(int page, String goods_type, String variety){
        mSubscription = RxManager.getInstance().doSubscribe(miaomuModel.getSeedlings(page, goods_type, variety), new RxSubscriber<AttentionList>(false) {
            @Override
            protected void _onNext(AttentionList result) {
                mView.onSuccess(result);
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }
    public void getFlowers(int page){
        mSubscription = RxManager.getInstance().doSubscribe(miaomuModel.getFlowers(page), new RxSubscriber<AttentionList>(false) {
            @Override
            protected void _onNext(AttentionList attentionList) {
                mView.onSuccess(attentionList);
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }
}
